package cc.androidos;

import cc.androidos.commons.GlobalParameter;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.util.Log;

public class DBCreate {
	


	public void dbCreateSql(SQLiteDatabase db) {
		

		for (String tn : GlobalParameter.TABLE_NAME_SFX) {
			db.execSQL("CREATE TABLE " 
					+ (GlobalParameter.TABLE_NAME_PFX+tn) 
					+ " (" + "word"+ " TEXT," +"target_language"+ " TEXT" + ");");
		}
		
	}
	
	public void dbInsertSql(SQLiteDatabase db) {
		for (String tn : GlobalParameter.TABLE_NAME_SFX) {
			String sql_1 = "insert into " + (GlobalParameter.TABLE_NAME_PFX+tn) 
			+ " (word, target_language) values('"+tn+"B"+"', '一个');";
			String sql_2 = "insert into " + (GlobalParameter.TABLE_NAME_PFX+tn) 
			+ " (word, target_language) values('"+tn+"c"+"', 'Tom Kao');";
			String sql_3 = "insert into " + (GlobalParameter.TABLE_NAME_PFX+tn) 
			+ " (word, target_language) values('"+tn+"c"+"', '关于');";
			try {
				db.execSQL(sql_1);
				db.execSQL(sql_2);
				db.execSQL(sql_3);
			} catch (SQLException e) {
				Log.e("ERROR", e.toString());
			}
		}
		
	}
}
